/**
 * @description 框架核心文件
 * @author cleverstone
 */
import util from './util'
import guard from './guard'

// 注册cleverApp对象
let CleverAppConstructor = new Function()
window.$cleverApp = new CleverAppConstructor()

// 注册框架基本服务
CleverAppConstructor.prototype.$config = require('../app')
CleverAppConstructor.prototype.$router = require('../page')
CleverAppConstructor.prototype.$push = function (view) {
    window.location.href = `${this.$config.rootUri + view}.html`
    throw 'The page has been redirected'
}
CleverAppConstructor.prototype.$util = util
CleverAppConstructor.prototype.$frameworkName = 'clever multi-page'
CleverAppConstructor.prototype.$frameworkVersion = '0.1.0'

// 注册路由守护
guard.call($cleverApp)

// 注册其他服务